package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.LuntaiStore;
import com.ruoyi.system.domain.dto.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LuntaiClaimsRequest;
import com.ruoyi.system.service.ILuntaiClaimsRequestService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2025-03-13
 */
@RestController
@RequestMapping("/claimRequest")
public class LuntaiClaimsRequestController extends BaseController {
    @Autowired
    private ILuntaiClaimsRequestService luntaiClaimsRequestService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    public TableDataInfo list(LuntaiClaimsRequest luntaiClaimsRequest) {
        startPage();
        List<LuntaiClaimsRequest> list = luntaiClaimsRequestService.selectLuntaiClaimsRequestList(luntaiClaimsRequest);
        return getDataTable(list);
    }

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list2")
    public TableDataInfo list(LuntaiClaimsRequestDto requestDto) {
        startPage();
        List<LuntaiClaimsRequestDto> list = luntaiClaimsRequestService.selectLuntaiClaimsRequestList2(requestDto);
        return getDataTable(list);
    }

    @GetMapping("/claimRequestDetail")
    public AjaxResult claimRequestDetail(LuntaiClaimsRequestDto dto) {
        LuntaiClaimsRequestDetailDto detail = luntaiClaimsRequestService.claimRequestDetail(dto);
        return AjaxResult.success(detail);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LuntaiClaimsRequest luntaiClaimsRequest) {
        List<LuntaiClaimsRequest> list = luntaiClaimsRequestService.selectLuntaiClaimsRequestList(luntaiClaimsRequest);
        ExcelUtil<LuntaiClaimsRequest> util = new ExcelUtil<LuntaiClaimsRequest>(LuntaiClaimsRequest.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return success(luntaiClaimsRequestService.selectLuntaiClaimsRequestById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody LuntaiClaimsRequest luntaiClaimsRequest) {
        return toAjax(luntaiClaimsRequestService.insertLuntaiClaimsRequest(luntaiClaimsRequest));
    }

    /**
     * 修改【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody LuntaiClaimsRequest luntaiClaimsRequest) {
        return AjaxResult.success(luntaiClaimsRequestService.updateLuntaiClaimsRequest(luntaiClaimsRequest));
    }

    /**
     * 删除【请填写功能名称】
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(luntaiClaimsRequestService.deleteLuntaiClaimsRequestByIds(ids));
    }

    @PostMapping("/getQrcodeInfo")
    public AjaxResult getQrcodeInfo(@RequestParam String barcode) {
        List<String> location = luntaiClaimsRequestService.getQrcodeInfo(barcode);
        return AjaxResult.success("查询成功", location);
    }

    /**
     * 导出门店信息列表
     */
    @Log(title = "导出理赔列表", businessType = BusinessType.EXPORT)
    @PostMapping("/exportClaimRequestList")
    public void exportInstallList(HttpServletResponse response, LuntaiClaimsRequestDto requestDto) {
        List<ClaimsRequestExcel> list = luntaiClaimsRequestService.selectLuntaiClaimsRequestList3(requestDto);
        ExcelUtil<ClaimsRequestExcel> util = new ExcelUtil<ClaimsRequestExcel>(ClaimsRequestExcel.class);
        util.exportExcel(response, list, "门店信息数据");
    }

    /**
     * 导出门店信息列表
     */
    @Log(title = "导出理赔列表", businessType = BusinessType.EXPORT)
    @PostMapping("/exportClaimRequestList2")
    public void exportClaimRequestList2(HttpServletResponse response) {
        List<ClaimsRequestExcel2> list = luntaiClaimsRequestService.exportClaimRequestList2();
        ExcelUtil<ClaimsRequestExcel2> util = new ExcelUtil<ClaimsRequestExcel2>(ClaimsRequestExcel2.class);
        util.exportExcel(response, list, "理赔列表数据");
    }
}
